// site-helper-guiView.cpp : implementation of the CsitehelperhtmlView class
//

#include "stdafx.h"
#include "site-helper-gui.h"

#include "site-helper-guiDoc.h"
#include "site-helper-guiView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CsitehelperhtmlView

IMPLEMENT_DYNCREATE(CsitehelperhtmlView, CHtmlView)

BEGIN_MESSAGE_MAP(CsitehelperhtmlView, CHtmlView)
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, &CHtmlView::OnFilePrint)
END_MESSAGE_MAP()

// CsitehelperhtmlView construction/destruction

CsitehelperhtmlView::CsitehelperhtmlView()
{
	// TODO: add construction code here

}

CsitehelperhtmlView::~CsitehelperhtmlView()
{
}

BOOL CsitehelperhtmlView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CHtmlView::PreCreateWindow(cs);
}

CString GetAppPath()
{
	TCHAR fileName[1024];
	::GetModuleFileName(NULL,fileName,1024);
	CString retStr = fileName;

	int i = retStr.ReverseFind('\\');
	if( i < 0)
		ASSERT(0);
	else
		retStr = retStr.Left(i);

	retStr.AppendChar('\\');

	return retStr;
}

void CsitehelperhtmlView::OnInitialUpdate()
{
	CHtmlView::OnInitialUpdate();

	//Navigate2(_T("http://www.msdn.microsoft.com/visualc/"),NULL,NULL);
	TCHAR fileName[1024];
	TCHAR pathName[1024];
	::GetModuleFileName(NULL,fileName,1024);
	::PathGetShortPath(pathName);

	TCHAR workDirName[1024];
	::GetCurrentDirectory(1024,workDirName);

	CString exePath = GetAppPath();
	CString htmlPath = exePath + _T("..\\Media\\TestSite\\index.html");
	Navigate2(htmlPath.GetBuffer(),NULL,NULL);
}


// CsitehelperhtmlView printing



// CsitehelperhtmlView diagnostics

#ifdef _DEBUG
void CsitehelperhtmlView::AssertValid() const
{
	CHtmlView::AssertValid();
}

void CsitehelperhtmlView::Dump(CDumpContext& dc) const
{
	CHtmlView::Dump(dc);
}

CsitehelperguiDoc* CsitehelperhtmlView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CsitehelperguiDoc)));
	return (CsitehelperguiDoc*)m_pDocument;
}
#endif //_DEBUG


// CsitehelperhtmlView message handlers
